To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 2 minutes to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
begin
using Plots
plotly()
end
Failed to load integration with PlotlyBase & PlotlyKaleido.
exception
Error message

The package PlotlyBase.jl could not load because it failed to initialize.

That's not nice! Things you could try:

  • Restart the notebook.
  • Try a different Julia version.
  • Contact the developers of PlotlyBase.jl about this error.

You might find useful information in the package installation log:

6.4 s
👀 Reading hidden code
let
plotlylower(x) = x
plotlylower(x::Vector{<:Number}) = x
plotlylower(x::AbstractVector) = Any[plotlylower(z) for z in x]
plotlylower(d::Dict) = Dict(
for (k,v) in d
)
plotlylower(Dict(:a => 1:10))
end
272 ms
begin
@eval Plots begin
plotlylower(x) = x
plotlylower(x::Vector{<:Number}) = x
plotlylower(x::AbstractVector) = Any[plotlylower(z) for z in x]
plotlylower(d::Dict) = Dict(
k => plotlylower(v)
for (k,v) in d
)

function _show(io::IO, ::MIME"text/html", plt::Plot{PlotlyBackend})
write(io, html_head(plt))
write(io, """
<div>
<script id=asdf>
const PLOT = this ?? document.createElement("div"); // currentScript.parentElement.firstElementChild;
(this == null ? Plotly.newPlot : Plotly.react)(PLOT, $(Main.PlutoRunner.publish_to_js(plotlylower(plotly_series(plt)))), $(plotly_layout_json(plt)));
return PLOT
</script>
</div>
""")
end

plotly_series_json(plt::Plot) = Main.PlutoRunner.publish_to_js(
plotly_series(plt) |> plotlylower
)
end
plotly()
end
👀 Reading hidden code
6.2 ms
using PlutoUI
👀 Reading hidden code
91.9 ms
x1 = rand(20)
👀 Reading hidden code
13.7 μs
x2 = rand(20)
👀 Reading hidden code
13.7 μs
p1 = plot(1:20, [x1 x2 rand(20)])
👀 Reading hidden code
Deprecated, use `AbstractPlutoDingetjes.Display.published_to_js(x)` instead of `PlutoRunner.publish_to_js(x)`.
3.0 s
plotly()
👀 Reading hidden code
32.4 μs
xs = rand(50000)
👀 Reading hidden code
236 μs
01.0×10​42.0×10​43.0×10​44.0×10​45.0×10​40.00.20.40.60.81.0
y1y2y3
let
p = plot(; ylim=(0,1))
plot!(xsy2)
plot!([xs[1:x] d])
end
👀 Reading hidden code
Deprecated, use `AbstractPlutoDingetjes.Display.published_to_js(x)` instead of `PlutoRunner.publish_to_js(x)`.
165 ms
xsy2 = xs .+ y2
👀 Reading hidden code
38.4 ms
d = y .+ xs[1:x]
👀 Reading hidden code
28.2 ms
@bind y Slider(0:.01:1)
👀 Reading hidden code
183 ms
@bind y2 Slider(0:.01:1)
👀 Reading hidden code
635 μs
@bind x Slider(1:length(xs))
👀 Reading hidden code
81.5 ms
methods (generic function with 6 methods)
methods
👀 Reading hidden code
8.6 μs
p2 = plot(1:20, [x1 x2 rand(20)])
👀 Reading hidden code
Deprecated, use `AbstractPlutoDingetjes.Display.published_to_js(x)` instead of `PlutoRunner.publish_to_js(x)`.
602 μs